package com.ddtech.utils;

import java.net.InetAddress;
import java.net.UnknownHostException;

/***
 *
 * 描述：
 * 作者： 普斌
 * 日期： 2019/12/4 16:43
 */
public class IpUtils {

    public static String getHostName() {
        try {
            return InetAddress.getLocalHost().getHostName();
        } catch (UnknownHostException ignored) {
        }
        return "未知";
    }

    public static String getHostIp() {
        try {
            return InetAddress.getLocalHost().getHostAddress();
        } catch (UnknownHostException ignored) {
        }
        return "127.0.0.1";
    }
}
